package com.zn;

import com.google.gson.Gson;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;

public class Util {

    private static Object list;

    public static void writerData(HttpServletResponse resp, Object List ){
        resp.setContentType("application/json;charset=utf-8");
        Gson gson = new Gson();
        String result = gson.toJson(list);
        try {
            resp.getWriter().println(result);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
    public static  String createOrderId(){
        LocalDateTime now = LocalDateTime.now();
        return " " + now.getDayOfMonth() + now.getMonthValue()
                + now.getDayOfMonth() + now.toLocalTime().toString();
    }
}
